import { updateVideoInfoService } from '../../../model/service/video/updateVideoInfoService';
import { updateVideoOtherService } from '../../../model/service/video/updateViewCount';

export async function updateVideo(ctx: Context, next: Next) {
  const { body } = ctx.request;
  const { id, danmuList } = body;

  try {
    const result = await updateVideoInfoService({ id, danmuList });
    ctx.api.success(result, 'success');
  } catch (error) {
    ctx.api.fail(-1, '查询失败')
  }


  return next();
}

export async function updateVideoOther(ctx: Context, next: Next) {
  const { body } = ctx.request;

  try {
    const result = await updateVideoOtherService(body);
    ctx.api.success(result, 'success');
  } catch (error) {
    ctx.api.fail(-1, '查询失败')
  }


  return next();
}